define(['../../carrys/cityList','../../carrys/jsonList','../../../../js/lib/other/sweet-alert'],function(cityData,jsonList) {
    return ['$scope','$location', '$interval','$timeout', function($scope,$location,$interval,$timeout) {
    	$scope.$emit("top-show",'true');//顶部显示
    	$scope.$emit('menuTypeLight','loan'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','62'); 	//显示底部文字
    	
    	//执业证号
    	if(resultData.loginUserData.lawyerNo != "" && resultData.loginUserData.lawyerNo != null){
    		$scope.practiceNo = resultData.loginUserData.lawyerNo;
            $scope.lawyerAreaName = resultData.loginUserData.lawfirmName; //律所名称
		}else{
			$scope.practiceNo = "";
            $scope.lawyerAreaName = ""; //律所名称
		}
    	
    	//申请人名称
    	if(resultData.loginUserData.userName != "" && resultData.loginUserData.userName != null){
    		$scope.applyUserName = resultData.loginUserData.userName;
		}else{
			$scope.applyUserName = "";
		}

    	
    	//联系方式
    	if(resultData.loginUserData.mobileNo != "" && resultData.loginUserData.mobileNo != null){
    		$scope.telNo = resultData.loginUserData.mobileNo;
		}else{
			$scope.telNo = "";
		}
    	if(NPLCacheData.firstStepData != null){
    		 $scope.practiceNo = NPLCacheData.firstStepData.lawyerNo;
    		 $scope.applyUserName = NPLCacheData.firstStepData.applyUserName;
    		 $scope.lawyerAreaName = NPLCacheData.firstStepData.lawyerCompName;
    		 $scope.telNo = NPLCacheData.firstStepData.mobileNo;
    	}
    	
    	//点击下一步
    	$scope.goNext = function(){
    		if(! $scope.practiceNo){
    			$scope.$emit("promptAlertMsg","执业证号不能为空");
    			$scope.$emit("showCollect",true);
    			$timeout(function(){
    				$scope.$emit("showCollect",false);
    			},transData.promptTime);
                return;
    		}else if(($scope.practiceNo).length != 17 || isNaN($scope.practiceNo *1)){
    			$scope.$emit("promptAlertMsg","执业证号格式不正确");
        		$scope.$emit("showCollect",true);
        		$timeout(function(){
        			$scope.$emit("showCollect",false);
        		},transData.promptTime);
                return;
    		}else if(! $scope.applyUserName){
    			$scope.$emit("promptAlertMsg","申请人名称不能为空");
    			$scope.$emit("showCollect",true);
    			$timeout(function(){
    				$scope.$emit("showCollect",false);
    			},transData.promptTime);
                return;
    		}else if(! $scope.lawyerAreaName){
    			$scope.$emit("promptAlertMsg","律所名称不能为空");
    			$scope.$emit("showCollect",true);
    			$timeout(function(){
    				$scope.$emit("showCollect",false);
    			},transData.promptTime);
                return;
    		}else if(! _SYT_util.isValidNo($scope.telNo)){
    			$scope.$emit("promptAlertMsg","联系手机号格式不正确");
    			$scope.$emit("showCollect",true);
    			$timeout(function(){
    				$scope.$emit("showCollect",false);
    			},transData.promptTime);
                return;
    		}
    		saveData();
    		
    	}
    	
    	//存储数据
    	function saveData(){
    		NPLCacheData.firstStepData = {};
    		NPLCacheData.firstStepData.lawyerNo = $scope.practiceNo;
    		NPLCacheData.firstStepData.applyUserName = $scope.applyUserName;
    		NPLCacheData.firstStepData.lawyerCompName = $scope.lawyerAreaName;
    		NPLCacheData.firstStepData.mobileNo = $scope.telNo;
    		$scope.$emit("goNext","/applyNplSec");
    	}
    	
    	$scope.$apply();
    }];
});